{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [],
   "source": [
    "from train_and_eval import train_test_all\n",
    "from config import config"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    },
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training on ./data/BSD100/img_001.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03311218153671673\n",
      "Finish evaluation\n",
      "Average psnr: 24.98725085974328\n",
      "Average ssim: 0.8370906001820796\n",
      "Starting training on ./data/BSD100/img_002.png with resolution factor 2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/galprz/miniconda3/envs/zssr/lib/python3.7/site-packages/skimage/metrics/_structural_similarity.py:108: UserWarning: Inputs have mismatched dtype.  Setting data_range based on im1.dtype.\n",
      "  im2[..., ch], **args)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done training.\n",
      "Avg training loss is 0.02434782367040724\n",
      "Finish evaluation\n",
      "Average psnr: 28.9505982038949\n",
      "Average ssim: 0.9242605825487465\n",
      "Starting training on ./data/BSD100/img_003.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03874655639652542\n",
      "Finish evaluation\n",
      "Average psnr: 23.332131271758023\n",
      "Average ssim: 0.7676153399969492\n",
      "Starting training on ./data/BSD100/img_004.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02265592843735437\n",
      "Finish evaluation\n",
      "Average psnr: 33.157931173941634\n",
      "Average ssim: 0.9665860256630858\n",
      "Starting training on ./data/BSD100/img_005.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03176492194376718\n",
      "Finish evaluation\n",
      "Average psnr: 28.277392788223672\n",
      "Average ssim: 0.9208124507000898\n",
      "Starting training on ./data/BSD100/img_006.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.017786371195462235\n",
      "Finish evaluation\n",
      "Average psnr: 35.070340181889726\n",
      "Average ssim: 0.9705763547288541\n",
      "Starting training on ./data/BSD100/img_007.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.040183182732269104\n",
      "Finish evaluation\n",
      "Average psnr: 29.429664022749307\n",
      "Average ssim: 0.9435142077016572\n",
      "Starting training on ./data/BSD100/img_008.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04453741148241849\n",
      "Finish evaluation\n",
      "Average psnr: 20.430873936682286\n",
      "Average ssim: 0.7376524915017452\n",
      "Starting training on ./data/BSD100/img_009.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.037283555911523\n",
      "Finish evaluation\n",
      "Average psnr: 29.93300976978523\n",
      "Average ssim: 0.9438770498123819\n",
      "Starting training on ./data/BSD100/img_010.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024213874546635785\n",
      "Finish evaluation\n",
      "Average psnr: 31.484218950977613\n",
      "Average ssim: 0.948809854634491\n",
      "Starting training on ./data/BSD100/img_011.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04166567583327695\n",
      "Finish evaluation\n",
      "Average psnr: 26.953606600630323\n",
      "Average ssim: 0.921353640951793\n",
      "Starting training on ./data/BSD100/img_012.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03658851031600161\n",
      "Finish evaluation\n",
      "Average psnr: 25.588018876497706\n",
      "Average ssim: 0.8092269376616398\n",
      "Starting training on ./data/BSD100/img_013.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027229761368958938\n",
      "Finish evaluation\n",
      "Average psnr: 33.47886838789748\n",
      "Average ssim: 0.964841351788246\n",
      "Starting training on ./data/BSD100/img_014.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02746976967720327\n",
      "Finish evaluation\n",
      "Average psnr: 25.823978814978133\n",
      "Average ssim: 0.8342572788999689\n",
      "Starting training on ./data/BSD100/img_015.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03190987107193915\n",
      "Finish evaluation\n",
      "Average psnr: 27.255495520661892\n",
      "Average ssim: 0.9132928221156096\n",
      "Starting training on ./data/BSD100/img_016.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05079609056879211\n",
      "Finish evaluation\n",
      "Average psnr: 28.792139898645253\n",
      "Average ssim: 0.9064558323496308\n",
      "Starting training on ./data/BSD100/img_017.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014640530558893666\n",
      "Finish evaluation\n",
      "Average psnr: 30.957857793344395\n",
      "Average ssim: 0.9027450662914428\n",
      "Starting training on ./data/BSD100/img_018.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.019420215044442298\n",
      "Finish evaluation\n",
      "Average psnr: 29.69659186511595\n",
      "Average ssim: 0.9190197154529828\n",
      "Starting training on ./data/BSD100/img_019.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03228335309597116\n",
      "Finish evaluation\n",
      "Average psnr: 26.780586507320017\n",
      "Average ssim: 0.887022731321644\n",
      "Starting training on ./data/BSD100/img_020.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03390012123373602\n",
      "Finish evaluation\n",
      "Average psnr: 27.798627984738204\n",
      "Average ssim: 0.9298125367280664\n",
      "Starting training on ./data/BSD100/img_021.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0449845574928563\n",
      "Finish evaluation\n",
      "Average psnr: 24.707480319061553\n",
      "Average ssim: 0.90204474831538\n",
      "Starting training on ./data/BSD100/img_022.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04338934042084182\n",
      "Finish evaluation\n",
      "Average psnr: 25.68942936915683\n",
      "Average ssim: 0.8808875859116209\n",
      "Starting training on ./data/BSD100/img_023.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03842784623927664\n",
      "Finish evaluation\n",
      "Average psnr: 21.82210090006283\n",
      "Average ssim: 0.7067522045869244\n",
      "Starting training on ./data/BSD100/img_024.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027326387342500907\n",
      "Finish evaluation\n",
      "Average psnr: 28.47877146790492\n",
      "Average ssim: 0.9422271701500508\n",
      "Starting training on ./data/BSD100/img_025.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03322996233736652\n",
      "Finish evaluation\n",
      "Average psnr: 30.41453335138233\n",
      "Average ssim: 0.9568238705669581\n",
      "Starting training on ./data/BSD100/img_026.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03427785195762392\n",
      "Finish evaluation\n",
      "Average psnr: 29.921661741425872\n",
      "Average ssim: 0.9548258838929445\n",
      "Starting training on ./data/BSD100/img_027.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0326686288047532\n",
      "Finish evaluation\n",
      "Average psnr: 29.976572426597848\n",
      "Average ssim: 0.9281156311784798\n",
      "Starting training on ./data/BSD100/img_028.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.020407737012035958\n",
      "Finish evaluation\n",
      "Average psnr: 31.440004015314756\n",
      "Average ssim: 0.9529073154466116\n",
      "Starting training on ./data/BSD100/img_029.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014870871897345065\n",
      "Finish evaluation\n",
      "Average psnr: 33.43046300904576\n",
      "Average ssim: 0.9648185395196296\n",
      "Starting training on ./data/BSD100/img_030.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0543742588623185\n",
      "Finish evaluation\n",
      "Average psnr: 21.305972211842374\n",
      "Average ssim: 0.7964176649363554\n",
      "Starting training on ./data/BSD100/img_031.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028208367101876436\n",
      "Finish evaluation\n",
      "Average psnr: 32.168089049342996\n",
      "Average ssim: 0.9596027226093805\n",
      "Starting training on ./data/BSD100/img_032.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05662328987279603\n",
      "Finish evaluation\n",
      "Average psnr: 18.319675288182097\n",
      "Average ssim: 0.6111810761519516\n",
      "Starting training on ./data/BSD100/img_033.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.041345460205161645\n",
      "Finish evaluation\n",
      "Average psnr: 27.801251792468328\n",
      "Average ssim: 0.9170573336661668\n",
      "Starting training on ./data/BSD100/img_034.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.032258130094691695\n",
      "Finish evaluation\n",
      "Average psnr: 26.060723876542177\n",
      "Average ssim: 0.9142538021411237\n",
      "Starting training on ./data/BSD100/img_035.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.019785258071646706\n",
      "Finish evaluation\n",
      "Average psnr: 36.435745009148384\n",
      "Average ssim: 0.971817712521995\n",
      "Starting training on ./data/BSD100/img_036.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03861025482779717\n",
      "Finish evaluation\n",
      "Average psnr: 29.443508990239508\n",
      "Average ssim: 0.9287523382709377\n",
      "Starting training on ./data/BSD100/img_037.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02612632856302673\n",
      "Finish evaluation\n",
      "Average psnr: 24.395536498447186\n",
      "Average ssim: 0.6876857083682272\n",
      "Starting training on ./data/BSD100/img_038.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025898218895259315\n",
      "Finish evaluation\n",
      "Average psnr: 29.014423673240973\n",
      "Average ssim: 0.8930550205110966\n",
      "Starting training on ./data/BSD100/img_039.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.030242527293449985\n",
      "Finish evaluation\n",
      "Average psnr: 26.372204996916352\n",
      "Average ssim: 0.8575778132826265\n",
      "Starting training on ./data/BSD100/img_040.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025241833457642675\n",
      "Finish evaluation\n",
      "Average psnr: 37.451013200134604\n",
      "Average ssim: 0.988200001080854\n",
      "Starting training on ./data/BSD100/img_041.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.036905360436748046\n",
      "Finish evaluation\n",
      "Average psnr: 28.759889900785588\n",
      "Average ssim: 0.9217952884060794\n",
      "Starting training on ./data/BSD100/img_042.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.030551034346574024\n",
      "Finish evaluation\n",
      "Average psnr: 26.451423062358263\n",
      "Average ssim: 0.8694927670688063\n",
      "Starting training on ./data/BSD100/img_043.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02662980014854519\n",
      "Finish evaluation\n",
      "Average psnr: 28.000509128709908\n",
      "Average ssim: 0.9146685496223269\n",
      "Starting training on ./data/BSD100/img_044.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03507905815194769\n",
      "Finish evaluation\n",
      "Average psnr: 28.85700880433952\n",
      "Average ssim: 0.9546374370976065\n",
      "Starting training on ./data/BSD100/img_045.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02738969930132934\n",
      "Finish evaluation\n",
      "Average psnr: 24.57865908326315\n",
      "Average ssim: 0.8530764156993788\n",
      "Starting training on ./data/BSD100/img_046.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.013389328515373031\n",
      "Finish evaluation\n",
      "Average psnr: 32.72611069986557\n",
      "Average ssim: 0.9544229641945438\n",
      "Starting training on ./data/BSD100/img_047.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04352129775337673\n",
      "Finish evaluation\n",
      "Average psnr: 25.239636382451934\n",
      "Average ssim: 0.8868728505845634\n",
      "Starting training on ./data/BSD100/img_048.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.029861786794263847\n",
      "Finish evaluation\n",
      "Average psnr: 26.440550721715802\n",
      "Average ssim: 0.8679607823501425\n",
      "Starting training on ./data/BSD100/img_049.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05257315915426837\n",
      "Finish evaluation\n",
      "Average psnr: 29.380885892846763\n",
      "Average ssim: 0.9633591700124334\n",
      "Starting training on ./data/BSD100/img_050.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.013792822398802229\n",
      "Finish evaluation\n",
      "Average psnr: 32.5870956188967\n",
      "Average ssim: 0.9423449136821763\n",
      "Starting training on ./data/BSD100/img_051.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03493717637593005\n",
      "Finish evaluation\n",
      "Average psnr: 26.530846548300886\n",
      "Average ssim: 0.8748585219704674\n",
      "Starting training on ./data/BSD100/img_052.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0358799004109755\n",
      "Finish evaluation\n",
      "Average psnr: 24.763675687339614\n",
      "Average ssim: 0.8873050195851397\n",
      "Starting training on ./data/BSD100/img_053.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.016377541755508807\n",
      "Finish evaluation\n",
      "Average psnr: 33.51682865704132\n",
      "Average ssim: 0.9525982496775892\n",
      "Starting training on ./data/BSD100/img_054.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01456419655702535\n",
      "Finish evaluation\n",
      "Average psnr: 33.851819317146735\n",
      "Average ssim: 0.9428354782483405\n",
      "Starting training on ./data/BSD100/img_055.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03642570248431054\n",
      "Finish evaluation\n",
      "Average psnr: 29.885385636281097\n",
      "Average ssim: 0.9395107734585286\n",
      "Starting training on ./data/BSD100/img_056.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03607274374355476\n",
      "Finish evaluation\n",
      "Average psnr: 27.404647110697407\n",
      "Average ssim: 0.9067689187203576\n",
      "Starting training on ./data/BSD100/img_057.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.048771277534558205\n",
      "Finish evaluation\n",
      "Average psnr: 18.40887949740235\n",
      "Average ssim: 0.596173968554783\n",
      "Starting training on ./data/BSD100/img_058.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.023153955423438972\n",
      "Finish evaluation\n",
      "Average psnr: 28.789167047601566\n",
      "Average ssim: 0.9006898102485946\n",
      "Starting training on ./data/BSD100/img_059.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0144858768148476\n",
      "Finish evaluation\n",
      "Average psnr: 31.796748649075\n",
      "Average ssim: 0.9396228833116068\n",
      "Starting training on ./data/BSD100/img_060.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02140370772361932\n",
      "Finish evaluation\n",
      "Average psnr: 27.888076146767602\n",
      "Average ssim: 0.8651424991897755\n",
      "Starting training on ./data/BSD100/img_061.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.015283190862323279\n",
      "Finish evaluation\n",
      "Average psnr: 32.22987368791823\n",
      "Average ssim: 0.9393460150619591\n",
      "Starting training on ./data/BSD100/img_062.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0221812149719197\n",
      "Finish evaluation\n",
      "Average psnr: 30.289623243436203\n",
      "Average ssim: 0.9342735913822802\n",
      "Starting training on ./data/BSD100/img_063.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02811645259232627\n",
      "Finish evaluation\n",
      "Average psnr: 36.15693311853205\n",
      "Average ssim: 0.9864630039128146\n",
      "Starting training on ./data/BSD100/img_064.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.040720921086514844\n",
      "Finish evaluation\n",
      "Average psnr: 26.575716957585975\n",
      "Average ssim: 0.9111833320084815\n",
      "Starting training on ./data/BSD100/img_065.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.042946942979166305\n",
      "Finish evaluation\n",
      "Average psnr: 23.01278213693047\n",
      "Average ssim: 0.7555584142583923\n",
      "Starting training on ./data/BSD100/img_066.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03565529951016535\n",
      "Finish evaluation\n",
      "Average psnr: 25.72149713248514\n",
      "Average ssim: 0.8757187212102795\n",
      "Starting training on ./data/BSD100/img_067.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.010641931371744599\n",
      "Finish evaluation\n",
      "Average psnr: 38.724005627862546\n",
      "Average ssim: 0.9942157817965039\n",
      "Starting training on ./data/BSD100/img_068.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06430875070770059\n",
      "Finish evaluation\n",
      "Average psnr: 23.447496906498593\n",
      "Average ssim: 0.8782096414819888\n",
      "Starting training on ./data/BSD100/img_069.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03459484469284356\n",
      "Finish evaluation\n",
      "Average psnr: 23.82197428989275\n",
      "Average ssim: 0.8597236197415189\n",
      "Starting training on ./data/BSD100/img_070.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.031070374558142672\n",
      "Finish evaluation\n",
      "Average psnr: 31.700807894473012\n",
      "Average ssim: 0.9568351709776083\n",
      "Starting training on ./data/BSD100/img_071.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.020605806131421243\n",
      "Finish evaluation\n",
      "Average psnr: 31.580563038859424\n",
      "Average ssim: 0.9395170222554977\n",
      "Starting training on ./data/BSD100/img_072.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.036619601180816315\n",
      "Finish evaluation\n",
      "Average psnr: 27.76102288435435\n",
      "Average ssim: 0.8929309050078366\n",
      "Starting training on ./data/BSD100/img_073.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03430154750581924\n",
      "Finish evaluation\n",
      "Average psnr: 23.783857914124038\n",
      "Average ssim: 0.7518316592825567\n",
      "Starting training on ./data/BSD100/img_074.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.032653938142638526\n",
      "Finish evaluation\n",
      "Average psnr: 27.75294943906534\n",
      "Average ssim: 0.8950637837334473\n",
      "Starting training on ./data/BSD100/img_075.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.041800586171594746\n",
      "Finish evaluation\n",
      "Average psnr: 20.83821916436169\n",
      "Average ssim: 0.7916049420424867\n",
      "Starting training on ./data/BSD100/img_076.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02181356425662383\n",
      "Finish evaluation\n",
      "Average psnr: 27.491234022562992\n",
      "Average ssim: 0.8770747971671039\n",
      "Starting training on ./data/BSD100/img_077.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03299490006415933\n",
      "Finish evaluation\n",
      "Average psnr: 25.456700284087468\n",
      "Average ssim: 0.8419362754647314\n",
      "Starting training on ./data/BSD100/img_078.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02540529206161465\n",
      "Finish evaluation\n",
      "Average psnr: 31.764391121059937\n",
      "Average ssim: 0.9500680671203283\n",
      "Starting training on ./data/BSD100/img_079.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024096331757821554\n",
      "Finish evaluation\n",
      "Average psnr: 34.36930850736994\n",
      "Average ssim: 0.984514928608197\n",
      "Starting training on ./data/BSD100/img_080.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.017406336581313363\n",
      "Finish evaluation\n",
      "Average psnr: 31.649973947312034\n",
      "Average ssim: 0.9481301173974922\n",
      "Starting training on ./data/BSD100/img_081.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.012487239153531353\n",
      "Finish evaluation\n",
      "Average psnr: 37.32027479924823\n",
      "Average ssim: 0.9819303521563696\n",
      "Starting training on ./data/BSD100/img_082.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024638559083493362\n",
      "Finish evaluation\n",
      "Average psnr: 25.02786188608149\n",
      "Average ssim: 0.8104540746006891\n",
      "Starting training on ./data/BSD100/img_083.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03568116561386432\n",
      "Finish evaluation\n",
      "Average psnr: 23.994424614911157\n",
      "Average ssim: 0.8412109090834715\n",
      "Starting training on ./data/BSD100/img_084.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.043293941666689185\n",
      "Finish evaluation\n",
      "Average psnr: 22.986998669562738\n",
      "Average ssim: 0.8519190051235256\n",
      "Starting training on ./data/BSD100/img_085.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03247155551455627\n",
      "Finish evaluation\n",
      "Average psnr: 27.209940362232345\n",
      "Average ssim: 0.9305104707765978\n",
      "Starting training on ./data/BSD100/img_086.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04034356420262322\n",
      "Finish evaluation\n",
      "Average psnr: 22.429342549644677\n",
      "Average ssim: 0.745330514474264\n",
      "Starting training on ./data/BSD100/img_087.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027450921438419835\n",
      "Finish evaluation\n",
      "Average psnr: 29.016895981601415\n",
      "Average ssim: 0.9087766133149944\n",
      "Starting training on ./data/BSD100/img_088.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025925000287462283\n",
      "Finish evaluation\n",
      "Average psnr: 33.36947801660533\n",
      "Average ssim: 0.9593228325617716\n",
      "Starting training on ./data/BSD100/img_089.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02870302778647531\n",
      "Finish evaluation\n",
      "Average psnr: 28.51317918894744\n",
      "Average ssim: 0.8618166811572747\n",
      "Starting training on ./data/BSD100/img_090.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03953959207673143\n",
      "Finish evaluation\n",
      "Average psnr: 23.316326975949487\n",
      "Average ssim: 0.7998190355609974\n",
      "Starting training on ./data/BSD100/img_091.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024560386380300538\n",
      "Finish evaluation\n",
      "Average psnr: 30.902795779222533\n",
      "Average ssim: 0.9190009953544528\n",
      "Starting training on ./data/BSD100/img_092.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.034900649107394655\n",
      "Finish evaluation\n",
      "Average psnr: 27.50162984143916\n",
      "Average ssim: 0.9005108969403128\n",
      "Starting training on ./data/BSD100/img_093.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028570634194719724\n",
      "Finish evaluation\n",
      "Average psnr: 34.44724271591689\n",
      "Average ssim: 0.978512139330368\n",
      "Starting training on ./data/BSD100/img_094.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.038823986397188835\n",
      "Finish evaluation\n",
      "Average psnr: 28.299556444117087\n",
      "Average ssim: 0.9265712785543364\n",
      "Starting training on ./data/BSD100/img_095.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.039786881010222735\n",
      "Finish evaluation\n",
      "Average psnr: 28.336929847987573\n",
      "Average ssim: 0.9396870418349986\n",
      "Starting training on ./data/BSD100/img_096.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0446530994722325\n",
      "Finish evaluation\n",
      "Average psnr: 18.540562708430887\n",
      "Average ssim: 0.5057336333739557\n",
      "Starting training on ./data/BSD100/img_097.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.023841596600014694\n",
      "Finish evaluation\n",
      "Average psnr: 27.942378487631174\n",
      "Average ssim: 0.8436874608419154\n",
      "Starting training on ./data/BSD100/img_098.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.039941948647747735\n",
      "Finish evaluation\n",
      "Average psnr: 28.191200012702026\n",
      "Average ssim: 0.934667989238774\n",
      "Starting training on ./data/BSD100/img_099.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03469295848157754\n",
      "Finish evaluation\n",
      "Average psnr: 28.98394085487734\n",
      "Average ssim: 0.925068516634326\n",
      "Starting training on ./data/BSD100/img_100.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03879993600248953\n",
      "Finish evaluation\n",
      "Average psnr: 27.105353854826678\n",
      "Average ssim: 0.9162292641531783\n",
      "Average psnr on all images: 28.262514330995277\n",
      "Average ssim on all images: 0.8903292377080173\n"
     ]
    }
   ],
   "source": [
    "config[\"sr_factor\"] = 2\n",
    "config[\"loss_type\"] = \"l1\"\n",
    "config[\"metrics\"] = [\"psnr\",\"ssim\"]\n",
    "train_test_all(\"./data/BSD100\", \"./data/BSD100/unknown_kernel_sr2\", config)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training on ./data/BSD100/img_001.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.1069722406492375\n",
      "Finish evaluation\n",
      "Average psnr: 24.42620103847669\n",
      "Average ssim: 0.8127435004873237\n",
      "Starting training on ./data/BSD100/img_002.png with resolution factor 2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/galprz/miniconda3/envs/zssr/lib/python3.7/site-packages/skimage/metrics/_structural_similarity.py:108: UserWarning: Inputs have mismatched dtype.  Setting data_range based on im1.dtype.\n",
      "  im2[..., ch], **args)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done training.\n",
      "Avg training loss is 0.06142037199570401\n",
      "Finish evaluation\n",
      "Average psnr: 28.055049096950025\n",
      "Average ssim: 0.9094424772666815\n",
      "Starting training on ./data/BSD100/img_003.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10270989450192687\n",
      "Finish evaluation\n",
      "Average psnr: 24.23167395488334\n",
      "Average ssim: 0.8800124071102361\n",
      "Starting training on ./data/BSD100/img_004.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06078266625357146\n",
      "Finish evaluation\n",
      "Average psnr: 31.89234889737696\n",
      "Average ssim: 0.9548117647162995\n",
      "Starting training on ./data/BSD100/img_005.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08644943049933651\n",
      "Finish evaluation\n",
      "Average psnr: 27.64456010829366\n",
      "Average ssim: 0.9012474622022206\n",
      "Starting training on ./data/BSD100/img_006.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04607325751740154\n",
      "Finish evaluation\n",
      "Average psnr: 33.98247884269288\n",
      "Average ssim: 0.9658509677170498\n",
      "Starting training on ./data/BSD100/img_007.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10306995465318755\n",
      "Finish evaluation\n",
      "Average psnr: 28.494924598284367\n",
      "Average ssim: 0.9286847335766101\n",
      "Starting training on ./data/BSD100/img_008.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.1159646675580799\n",
      "Finish evaluation\n",
      "Average psnr: 21.89455857346632\n",
      "Average ssim: 0.735218286280835\n",
      "Starting training on ./data/BSD100/img_009.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09072627938619934\n",
      "Finish evaluation\n",
      "Average psnr: 29.126905123369582\n",
      "Average ssim: 0.930841429530053\n",
      "Starting training on ./data/BSD100/img_010.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07077345517602297\n",
      "Finish evaluation\n",
      "Average psnr: 30.893803858573122\n",
      "Average ssim: 0.9400239233956448\n",
      "Starting training on ./data/BSD100/img_011.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.12880561338497862\n",
      "Finish evaluation\n",
      "Average psnr: 25.12628039064138\n",
      "Average ssim: 0.8803755745914348\n",
      "Starting training on ./data/BSD100/img_012.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10995901995661235\n",
      "Finish evaluation\n",
      "Average psnr: 26.804150149692894\n",
      "Average ssim: 0.8809532630923117\n",
      "Starting training on ./data/BSD100/img_013.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06514684929706083\n",
      "Finish evaluation\n",
      "Average psnr: 32.15548269535659\n",
      "Average ssim: 0.9510918555515776\n",
      "Starting training on ./data/BSD100/img_014.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08283157510185006\n",
      "Finish evaluation\n",
      "Average psnr: 27.080469959524073\n",
      "Average ssim: 0.9001675306312359\n",
      "Starting training on ./data/BSD100/img_015.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09175063846725048\n",
      "Finish evaluation\n",
      "Average psnr: 26.467240593169464\n",
      "Average ssim: 0.8892325432381574\n",
      "Starting training on ./data/BSD100/img_016.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.12750813674808728\n",
      "Finish evaluation\n",
      "Average psnr: 26.611565849526812\n",
      "Average ssim: 0.9204356495206799\n",
      "Starting training on ./data/BSD100/img_017.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.061939066220628156\n",
      "Finish evaluation\n",
      "Average psnr: 31.755965429062783\n",
      "Average ssim: 0.9393929980115313\n",
      "Starting training on ./data/BSD100/img_018.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0673960330020083\n",
      "Finish evaluation\n",
      "Average psnr: 30.1090652837204\n",
      "Average ssim: 0.9429543747019588\n",
      "Starting training on ./data/BSD100/img_019.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0864686578659728\n",
      "Finish evaluation\n",
      "Average psnr: 25.984292086611784\n",
      "Average ssim: 0.8708243444092952\n",
      "Starting training on ./data/BSD100/img_020.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0838871638816182\n",
      "Finish evaluation\n",
      "Average psnr: 26.45733764650778\n",
      "Average ssim: 0.9120512514855244\n",
      "Starting training on ./data/BSD100/img_021.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.12386435108019574\n",
      "Finish evaluation\n",
      "Average psnr: 23.164402395776918\n",
      "Average ssim: 0.8547517822323649\n",
      "Starting training on ./data/BSD100/img_022.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.12578173011246294\n",
      "Finish evaluation\n",
      "Average psnr: 24.987318618432393\n",
      "Average ssim: 0.8544497189596298\n",
      "Starting training on ./data/BSD100/img_023.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10453188227544917\n",
      "Finish evaluation\n",
      "Average psnr: 23.18554312689819\n",
      "Average ssim: 0.7399236070303997\n",
      "Starting training on ./data/BSD100/img_024.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.087869195802377\n",
      "Finish evaluation\n",
      "Average psnr: 27.34280921694872\n",
      "Average ssim: 0.9229760849072042\n",
      "Starting training on ./data/BSD100/img_025.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09418596637130965\n",
      "Finish evaluation\n",
      "Average psnr: 29.311051708822347\n",
      "Average ssim: 0.9448360702597021\n",
      "Starting training on ./data/BSD100/img_026.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0786440461726472\n",
      "Finish evaluation\n",
      "Average psnr: 28.981258871460184\n",
      "Average ssim: 0.942004429545408\n",
      "Starting training on ./data/BSD100/img_027.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10005314758803585\n",
      "Finish evaluation\n",
      "Average psnr: 28.471075024500582\n",
      "Average ssim: 0.9121589989550877\n",
      "Starting training on ./data/BSD100/img_028.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0638097659269772\n",
      "Finish evaluation\n",
      "Average psnr: 29.89608490682429\n",
      "Average ssim: 0.939030617641027\n",
      "Starting training on ./data/BSD100/img_029.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.055222369730472565\n",
      "Finish evaluation\n",
      "Average psnr: 31.13583741754708\n",
      "Average ssim: 0.9533430728584457\n",
      "Starting training on ./data/BSD100/img_030.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.12620029959938314\n",
      "Finish evaluation\n",
      "Average psnr: 20.521999901505303\n",
      "Average ssim: 0.7489886714074393\n",
      "Starting training on ./data/BSD100/img_031.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0736953535735017\n",
      "Finish evaluation\n",
      "Average psnr: 31.452656432126066\n",
      "Average ssim: 0.9517996322210635\n",
      "Starting training on ./data/BSD100/img_032.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.14241886456118952\n",
      "Finish evaluation\n",
      "Average psnr: 19.796023517798545\n",
      "Average ssim: 0.648952127632266\n",
      "Starting training on ./data/BSD100/img_033.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.1096323596516458\n",
      "Finish evaluation\n",
      "Average psnr: 27.189113769779667\n",
      "Average ssim: 0.896519232642966\n",
      "Starting training on ./data/BSD100/img_034.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0875147311477968\n",
      "Finish evaluation\n",
      "Average psnr: 25.14064886334723\n",
      "Average ssim: 0.8891132853201609\n",
      "Starting training on ./data/BSD100/img_035.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06241243044928749\n",
      "Finish evaluation\n",
      "Average psnr: 31.52668207615532\n",
      "Average ssim: 0.9638033756730334\n",
      "Starting training on ./data/BSD100/img_036.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10180611650247386\n",
      "Finish evaluation\n",
      "Average psnr: 28.245186174611664\n",
      "Average ssim: 0.9084133157194735\n",
      "Starting training on ./data/BSD100/img_037.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07160325197152573\n",
      "Finish evaluation\n",
      "Average psnr: 25.234190555623364\n",
      "Average ssim: 0.8284433220766434\n",
      "Starting training on ./data/BSD100/img_038.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07565609166527738\n",
      "Finish evaluation\n",
      "Average psnr: 28.5502517600644\n",
      "Average ssim: 0.8821073931737039\n",
      "Starting training on ./data/BSD100/img_039.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10459356644366047\n",
      "Finish evaluation\n",
      "Average psnr: 27.104563218115125\n",
      "Average ssim: 0.8731713740966502\n",
      "Starting training on ./data/BSD100/img_040.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08813220269904279\n",
      "Finish evaluation\n",
      "Average psnr: 33.543914371403424\n",
      "Average ssim: 0.9776280604839783\n",
      "Starting training on ./data/BSD100/img_041.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10110695092099728\n",
      "Finish evaluation\n",
      "Average psnr: 27.475283590401315\n",
      "Average ssim: 0.9041154048377303\n",
      "Starting training on ./data/BSD100/img_042.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08761993684981129\n",
      "Finish evaluation\n",
      "Average psnr: 25.28793256522707\n",
      "Average ssim: 0.8373814595943238\n",
      "Starting training on ./data/BSD100/img_043.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0863076195415884\n",
      "Finish evaluation\n",
      "Average psnr: 26.96210727763915\n",
      "Average ssim: 0.9020437284694912\n",
      "Starting training on ./data/BSD100/img_044.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08754377826900765\n",
      "Finish evaluation\n",
      "Average psnr: 27.108817253168965\n",
      "Average ssim: 0.9339974595011422\n",
      "Starting training on ./data/BSD100/img_045.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0767108831960376\n",
      "Finish evaluation\n",
      "Average psnr: 23.63115557315481\n",
      "Average ssim: 0.8132780071061876\n",
      "Starting training on ./data/BSD100/img_046.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.045378924817732064\n",
      "Finish evaluation\n",
      "Average psnr: 31.318094105479986\n",
      "Average ssim: 0.9458274120667384\n",
      "Starting training on ./data/BSD100/img_047.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.11106104418487832\n",
      "Finish evaluation\n",
      "Average psnr: 23.94575321027491\n",
      "Average ssim: 0.8499709064299171\n",
      "Starting training on ./data/BSD100/img_048.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08127509824710318\n",
      "Finish evaluation\n",
      "Average psnr: 25.339392953396157\n",
      "Average ssim: 0.8323717734978379\n",
      "Starting training on ./data/BSD100/img_049.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.12276241611136068\n",
      "Finish evaluation\n",
      "Average psnr: 27.770912051413962\n",
      "Average ssim: 0.9510013102636637\n",
      "Starting training on ./data/BSD100/img_050.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04089497974013338\n",
      "Finish evaluation\n",
      "Average psnr: 31.91337521519899\n",
      "Average ssim: 0.9342187234387384\n",
      "Starting training on ./data/BSD100/img_051.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09213519332432511\n",
      "Finish evaluation\n",
      "Average psnr: 25.89980784428219\n",
      "Average ssim: 0.8499392398357631\n",
      "Starting training on ./data/BSD100/img_052.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09018429073661861\n",
      "Finish evaluation\n",
      "Average psnr: 22.92577584113007\n",
      "Average ssim: 0.8500557783599666\n",
      "Starting training on ./data/BSD100/img_053.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05557906653473873\n",
      "Finish evaluation\n",
      "Average psnr: 32.86980602346016\n",
      "Average ssim: 0.9466153190684228\n",
      "Starting training on ./data/BSD100/img_054.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05196414500622466\n",
      "Finish evaluation\n",
      "Average psnr: 33.52568324742527\n",
      "Average ssim: 0.9373040962357733\n",
      "Starting training on ./data/BSD100/img_055.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10963633671255395\n",
      "Finish evaluation\n",
      "Average psnr: 28.356367596049754\n",
      "Average ssim: 0.9245500012556903\n",
      "Starting training on ./data/BSD100/img_056.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.1116536948645469\n",
      "Finish evaluation\n",
      "Average psnr: 26.242135421777345\n",
      "Average ssim: 0.8834236181770644\n",
      "Starting training on ./data/BSD100/img_057.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.1329635520382683\n",
      "Finish evaluation\n",
      "Average psnr: 19.789211090309276\n",
      "Average ssim: 0.7326800805226706\n",
      "Starting training on ./data/BSD100/img_058.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07021667409946422\n",
      "Finish evaluation\n",
      "Average psnr: 28.067449205594954\n",
      "Average ssim: 0.880108881791647\n",
      "Starting training on ./data/BSD100/img_059.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.047404706810075456\n",
      "Finish evaluation\n",
      "Average psnr: 31.25634210626735\n",
      "Average ssim: 0.9331811510947562\n",
      "Starting training on ./data/BSD100/img_060.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08141335498283406\n",
      "Finish evaluation\n",
      "Average psnr: 28.287813076551807\n",
      "Average ssim: 0.8745483661081543\n",
      "Starting training on ./data/BSD100/img_061.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04808120551233244\n",
      "Finish evaluation\n",
      "Average psnr: 31.382832113428485\n",
      "Average ssim: 0.9298728710131314\n",
      "Starting training on ./data/BSD100/img_062.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06497161248975461\n",
      "Finish evaluation\n",
      "Average psnr: 29.663353109446476\n",
      "Average ssim: 0.9251093712771935\n",
      "Starting training on ./data/BSD100/img_063.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0803975641432375\n",
      "Finish evaluation\n",
      "Average psnr: 32.810603497163825\n",
      "Average ssim: 0.9720242065656658\n",
      "Starting training on ./data/BSD100/img_064.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10447382491708983\n",
      "Finish evaluation\n",
      "Average psnr: 25.84662143594489\n",
      "Average ssim: 0.8873899099655458\n",
      "Starting training on ./data/BSD100/img_065.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.11711069292361194\n",
      "Finish evaluation\n",
      "Average psnr: 24.432074654171274\n",
      "Average ssim: 0.792076622352308\n",
      "Starting training on ./data/BSD100/img_066.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09712929920394822\n",
      "Finish evaluation\n",
      "Average psnr: 26.897283727688084\n",
      "Average ssim: 0.891528025616135\n",
      "Starting training on ./data/BSD100/img_067.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.032724795936800465\n",
      "Finish evaluation\n",
      "Average psnr: 35.50647184840645\n",
      "Average ssim: 0.9915524091824404\n",
      "Starting training on ./data/BSD100/img_068.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.14670448248634244\n",
      "Finish evaluation\n",
      "Average psnr: 22.62891571306231\n",
      "Average ssim: 0.8408185494912751\n",
      "Starting training on ./data/BSD100/img_069.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09435255235374564\n",
      "Finish evaluation\n",
      "Average psnr: 23.47704630688137\n",
      "Average ssim: 0.8376079046964602\n",
      "Starting training on ./data/BSD100/img_070.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08755124463598327\n",
      "Finish evaluation\n",
      "Average psnr: 29.856346973346852\n",
      "Average ssim: 0.9442352805629257\n",
      "Starting training on ./data/BSD100/img_071.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07023152373362296\n",
      "Finish evaluation\n",
      "Average psnr: 30.27950745090921\n",
      "Average ssim: 0.9234026919034101\n",
      "Starting training on ./data/BSD100/img_072.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09714986907668632\n",
      "Finish evaluation\n",
      "Average psnr: 26.70322791341175\n",
      "Average ssim: 0.8597319864190517\n",
      "Starting training on ./data/BSD100/img_073.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09704386088812705\n",
      "Finish evaluation\n",
      "Average psnr: 24.953721335941147\n",
      "Average ssim: 0.7966672451512865\n",
      "Starting training on ./data/BSD100/img_074.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08529140696962281\n",
      "Finish evaluation\n",
      "Average psnr: 26.938666724010893\n",
      "Average ssim: 0.8723526784346965\n",
      "Starting training on ./data/BSD100/img_075.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.11710966857943204\n",
      "Finish evaluation\n",
      "Average psnr: 22.293953658513097\n",
      "Average ssim: 0.8130091722587457\n",
      "Starting training on ./data/BSD100/img_076.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07458089745723374\n",
      "Finish evaluation\n",
      "Average psnr: 28.722356726797997\n",
      "Average ssim: 0.896597295449197\n",
      "Starting training on ./data/BSD100/img_077.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09726437786132983\n",
      "Finish evaluation\n",
      "Average psnr: 24.79426489105244\n",
      "Average ssim: 0.801781252305379\n",
      "Starting training on ./data/BSD100/img_078.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0817783784748304\n",
      "Finish evaluation\n",
      "Average psnr: 30.337830866296144\n",
      "Average ssim: 0.9394968051800504\n",
      "Starting training on ./data/BSD100/img_079.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06911687066059301\n",
      "Finish evaluation\n",
      "Average psnr: 30.5417598985837\n",
      "Average ssim: 0.969171029068025\n",
      "Starting training on ./data/BSD100/img_080.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05101939914102602\n",
      "Finish evaluation\n",
      "Average psnr: 31.121659616148797\n",
      "Average ssim: 0.9384888820388574\n",
      "Starting training on ./data/BSD100/img_081.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.040842491690770234\n",
      "Finish evaluation\n",
      "Average psnr: 36.4153396543766\n",
      "Average ssim: 0.9794466424862676\n",
      "Starting training on ./data/BSD100/img_082.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09238017173391758\n",
      "Finish evaluation\n",
      "Average psnr: 25.053168778467505\n",
      "Average ssim: 0.8329871506212597\n",
      "Starting training on ./data/BSD100/img_083.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10443205231487161\n",
      "Finish evaluation\n",
      "Average psnr: 23.224488294720757\n",
      "Average ssim: 0.8025773734092221\n",
      "Starting training on ./data/BSD100/img_084.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10568409265563039\n",
      "Finish evaluation\n",
      "Average psnr: 21.95568174445217\n",
      "Average ssim: 0.8026024289244172\n",
      "Starting training on ./data/BSD100/img_085.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09576057959901224\n",
      "Finish evaluation\n",
      "Average psnr: 25.618316525886762\n",
      "Average ssim: 0.897276877569154\n",
      "Starting training on ./data/BSD100/img_086.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.11472508930923915\n",
      "Finish evaluation\n",
      "Average psnr: 23.617936063412234\n",
      "Average ssim: 0.8732655686086046\n",
      "Starting training on ./data/BSD100/img_087.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07997634520034978\n",
      "Finish evaluation\n",
      "Average psnr: 28.327970049770364\n",
      "Average ssim: 0.8905477386438262\n",
      "Starting training on ./data/BSD100/img_088.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0806247791883969\n",
      "Finish evaluation\n",
      "Average psnr: 31.279502123139167\n",
      "Average ssim: 0.9167191339300192\n",
      "Starting training on ./data/BSD100/img_089.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08448712734302671\n",
      "Finish evaluation\n",
      "Average psnr: 27.72519897572348\n",
      "Average ssim: 0.8384116559277395\n",
      "Starting training on ./data/BSD100/img_090.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10528356663071282\n",
      "Finish evaluation\n",
      "Average psnr: 24.527878363083886\n",
      "Average ssim: 0.8264954196581722\n",
      "Starting training on ./data/BSD100/img_091.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07303826783848281\n",
      "Finish evaluation\n",
      "Average psnr: 30.56459420550955\n",
      "Average ssim: 0.9097091668486431\n",
      "Starting training on ./data/BSD100/img_092.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.08895853235579954\n",
      "Finish evaluation\n",
      "Average psnr: 26.32209423903316\n",
      "Average ssim: 0.876583850925248\n",
      "Starting training on ./data/BSD100/img_093.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06365987293348455\n",
      "Finish evaluation\n",
      "Average psnr: 33.39478745123877\n",
      "Average ssim: 0.9724691169702301\n",
      "Starting training on ./data/BSD100/img_094.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.1169306282507311\n",
      "Finish evaluation\n",
      "Average psnr: 27.03460821665658\n",
      "Average ssim: 0.9069395804323105\n",
      "Starting training on ./data/BSD100/img_095.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.11234294372324896\n",
      "Finish evaluation\n",
      "Average psnr: 26.30883238376842\n",
      "Average ssim: 0.9115325804960529\n",
      "Starting training on ./data/BSD100/img_096.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.11081350639019863\n",
      "Finish evaluation\n",
      "Average psnr: 20.10299015921476\n",
      "Average ssim: 0.7500806103512987\n",
      "Starting training on ./data/BSD100/img_097.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.07743173682748682\n",
      "Finish evaluation\n",
      "Average psnr: 27.70374242415108\n",
      "Average ssim: 0.8260490694270803\n",
      "Starting training on ./data/BSD100/img_098.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.09176338847615931\n",
      "Finish evaluation\n",
      "Average psnr: 27.712206871981504\n",
      "Average ssim: 0.9217352630602101\n",
      "Starting training on ./data/BSD100/img_099.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10013317080712554\n",
      "Finish evaluation\n",
      "Average psnr: 27.253225913081796\n",
      "Average ssim: 0.8999196851245465\n",
      "Starting training on ./data/BSD100/img_100.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.10730826094894126\n",
      "Finish evaluation\n",
      "Average psnr: 26.1043006338442\n",
      "Average ssim: 0.8936652109316015\n",
      "Average psnr on all images: 27.51383542884842\n",
      "Average ssim on all images: 0.8938561508363394\n"
     ]
    }
   ],
   "source": [
    "config[\"loss_type\"]=\"hybrid\"\n",
    "config[\"metrics\"] = [\"psnr\",\"ssim\"]\n",
    "train_test_all(\"./data/BSD100\", \"./data/BSD100/unknown_kernel_sr2\", config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
